<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .move {
            position: relative;
            width: 300px;
            height: 300px;
            border: 1px solid #000;
            top: 0;
            left: 0;
            transition: all 1s;
        }

        .trans {
            transform: translateX(300px);
        }
    </style>
</head>

<body>
    <div class="move"></div>
    <script>
        setTimeout(() => {
            document.querySelector('.move').className = 'move trans';
        }, 5000);
    </script>
</body>

</html>